import { isFunc } from '../validator';

/**
 * 唤醒目标函数执行
*/
export function invoke(callee: any, caller: any, ...args: any): any {
    if (isFunc(callee)) return !!caller ? Reflect.apply(callee, caller, args) : callee(...args);
}

export function stringToLong(str:string):Long{
     let _uid: Long = (window as any).Long.fromValue(str);
     return _uid;
}

export function formatTimeString(time:number) {
    let hh = Math.floor(time / 3600);
    let mm = Math.floor(time / 60) % 60;
    let ss = Math.floor(time % 60);
    let str:string = (hh < 10 ? ('0' + hh) : hh) + ':' + (mm < 10 ? ('0' + mm) : mm) + ':' + (ss < 10 ? ('0' + ss) : ss);
    return str;
}